import { createRouter, createWebHashHistory } from "vue-router";

const routes = [
  {
    path: "/",
    component: () => import('@/layout'),
    redirect: '/home',
    children: [
      {
        path: "/home",
        name: "home",
        component: () => import("@/views/home"),
        meta: {
          title: "首页",
          isMenu: true,
          keepAlive: true,
          gift: true
        },
      },
      {
        path: "/login",
        name: "login",
        component: () => import("@/views/login"),
        meta: {
          title: "登录",
          isNavBar: true,
          keep: false

        }
      },
      {
        path: "/Codelogin",
        name: "Codelogin",
        component: () => import("@/views/login/Codelogin"),
        meta: {
          title: "验证码登录",
          isNavBar: true,
          keep: false

        }
      },
      {
        path: "/register",
        name: "register",
        component: () => import("@/views/login/register"),
        meta: {
          title: "账号注册",
          isNavBar: true,
          keep: false

        }
      },
      {
        path: "/foreget",
        name: "/foreget",
        component: () => import("@/views/login/forgetPwd"),
        meta: {
          title: "忘记密码",
          isNavBar: true,
          keep: false

        }
      },
      //
      {
        path: "/blindBoxpage",
        name: "blindBoxpage",
        component: () => import("@/views/home/blindBox-page"),
        meta: {
          title: "详情",
          name: "详情",
          isMenu: false,
          isNavBar: true,
          keep: true
        },
      },
      {
        path: "/CollectionPage",
        name: "CollectionPage",
        component: () => import("@/views/home/Collection-page"),
        meta: {
          title: "详情",
          name: "详情",
          isMenu: false,
          isNavBar: true,
          keep: true
        },
      },
      {
        path: "/NoticeList",
        name: "NoticeList",
        component: () => import("@/views/home/NoticeList"),
        meta: {
          title: "公告列表",
          name: "公告列表",
          isMenu: false,
          isNavBar: true,
          keep: false
        },
      },
      {
        path: "/NoticeInfo",
        name: "NoticeInfo",
        component: () => import("@/views/home/NoticeInfo"),
        meta: {
          title: "公告详情",
          name: "公告详情",
          isMenu: false,
          isNavBar: false,
          keep: true
        },
      },
      {
        path: "/gift",
        name: "gift",
        component: () => import("@/views/giftPage"),
        meta: {
          title: "赠品",
          isMenu: false,
          isMenu: true, keep: true

        },
      },
      //
      {
        path: "/moreBind",
        name: "moreBind",
        component: () => import("@/views/giftPage/moreBind"),
        meta: {
          title: "我的盲盒",
          name: "我的盲盒",
          isMenu: false,
          isNavBar: true,
          keep: true
        },
      },
      {
        path: "/morecolletion",
        name: "morecolletion",
        component: () => import("@/views/giftPage/morecolletion"),
        meta: {
          title: "我的藏品",
          name: "藏品",
          isMenu: false,
          isNavBar: true,
          keep: true
        },
      },
      {
        path: "/pageblindbox",
        name: "pageblindbox",
        component: () => import("@/views/giftPage/pageblindbox"),
        meta: {
          title: "我的盲盒",
          name: "详情",
          isMenu: false,
          isNavBar: true,
          keep: true
        },
      },
      {
        path: "/Mycollectioninner",
        name: "Mycollectioninner",
        component: () => import("@/views/giftPage/Mycollectioninner"),
        meta: {
          title: "我的藏品",
          isMenu: false,
          isNavBar: true,
          keep: true
        },
      },
      {
        path: "/Givefriends",
        name: "Givefriends",
        component: () => import("@/views/giftPage/Givefriends"),
        meta: {
          title: "赠与好友",
          name: '赠与好友',
          isMenu: false,
          isNavBar: true,
          keep: true
        },
      },
      {
        path: "/sellPage",
        name: "sellPage",
        component: () => import("@/views/giftPage/sellPage"),
        meta: {
          title: "出售",
          name: '出售',
          isMenu: false,
          isNavBar: false,
          keep: true,
          gift: true
        },
      },
      {
        path: "/Giftsued",
        name: "Giftsued",
        component: () => import("@/views/giftPage/Giftsued"),
        meta: {
          title: "赠与中",
          name: '赠与中',
          isMenu: false,
          isNavBar: false,
          keep: true
        },
      },
      {
        path: "/setting",
        name: "setting",
        component: () => import("@/views/me/setting"),
        meta: {
          title: "账户设置",
          name: '账户设置',
          isMenu: false,
          isNavBar: true,
          keep: true
        },
      },
      {
        path: "/msg",
        name: "msg",
        component: () => import("@/views/me/msg"),
        meta: {
          title: "消息中心",
          name: '消息中心',
          isMenu: false,
          isNavBar: true,
          keep: true
        },
      },


      {
        path: "/editPwd",
        name: "editPwd",
        component: () => import("@/views/me/setmore/editpwd"),
        meta: {
          title: "修改交易密码",
          name: '修改交易密码',
          isMenu: false,
          isNavBar: true,
          keep: false,

        },
      },
      {
        path: "/editLogin",
        name: "editLogin",
        component: () => import("@/views/me/setmore/editLogin"),
        meta: {
          title: "修改登录密码",
          name: '修改登录密码',
          isMenu: false,
          isNavBar: true,
          keep: true,

        },
      },
      {
        path: "/editAddress",
        name: "editAddress",
        component: () => import("@/views/me/setmore/editAddress"),
        meta: {
          title: "收货地址",
          name: '收货地址',
          isMenu: false,
          isNavBar: true,
          keep: true
        },
      },
      {
        path: "/balance",
        name: "balance",
        component: () => import("@/views/me/money/balance"),
        meta: {
          title: "余额",
          name: '余额',
          isMenu: false,
          isNavBar: true,
          keep: true
        },
      },
      {
        path: "/recharge",
        name: "recharge",
        component: () => import("@/views/me/money/recharge"),
        meta: {
          title: "充值",
          name: '充值',
          isMenu: false,
          isNavBar: true,
          keep: true
        },
      },
      {
        path: "/setPay",
        name: "setPay",
        component: () => import("@/views/me/money/setPay"),
        meta: {
          title: "收款设置",
          name: '收款设置',
          isMenu: false,
          isNavBar: true,
          keep: false
        },
      },
      {
        path: "/newsInfo",
        name: "newsInfo",
        component: () => import("@/views/me/newsInfo"),
        meta: {
          title: "消息详细",
          name: '消息详细',
          isMenu: false,
          isNavBar: true,
          keep: false
        },
      },

      {
        path: "/setAvatar",
        name: "setAvatar",
        component: () => import("@/views/me/setmore/setAvatar"),
        meta: {
          title: "头像设置",
          name: '头像设置',
          isMenu: false,
          isNavBar: true,
          keep: false
        },
      },
      {
        path: "/Withdrawal",
        name: "Withdrawal",
        component: () => import("@/views/me/money/Withdrawal"),
        meta: {
          title: "提现",
          name: '提现',
          isMenu: false,
          isNavBar: true,
          keep: true
        },
      },

      {
        path: "/realName",
        name: "realName",
        component: () => import("@/views/me/setmore/realName"),
        meta: {
          title: "实名认证",
          name: '实名认证',
          isMenu: false,
          isNavBar: true,
          keep: true
        },
      },


      {
        path: "/apply",
        name: "apply",
        component: () => import("@/views/me/order/apply"),
        meta: {
          title: "申购抽签",
          name: "申购抽签",
          isMenu: true,
          isNavBar: false,
          keep: true

        },
      },
      {
        path: "/applyDetails",
        name: "applyDetails",
        component: () => import("@/views/me/order/applyDetails"),
        meta: {
          title: "申购抽签",
          name: "申购抽签",
          isMenu: false,
          isNavBar: true,
          keep: true

        },
      },
      //
      {
        path: "/marketDetails",
        name: "marketDetails",
        component: () => import("@/views/market/marketDetails"),
        meta: {
          title: "详情",
          name: "详情",
          isMenu: false,
          isNavBar: true,
          keep: true

        },
      },
      {
        path: "/auction",
        name: "auction",
        component: () => import("@/views/market/auction"),
        meta: {
          title: "详情",
          name: "详情",
          isMenu: false,
          isNavBar: true,
          keep: true
        },
      },
      {
        path: "/market",
        name: "market",
        component: () => import("@/views/market/index"),
        meta: {
          title: "寄售/竞拍市场",
          name: "寄售/竞拍市场",
          isMenu: true,
          isNavBar: false,
          keep: true

        },
      },
      {
        path: "/me",
        name: "/me",
        component: () => import("@/views/blankLayout"),
        redirect: '/me/index',
        children: [
          {
            path: "/me",
            name: "me",
            component: () => import("@/views/me"),
            meta: {
              title: "个人中心",
              isMenu: true,
              gift: true
            },
          },

          {
            path: "/compose",
            name: "compose",
            component: () => import("@/views/me/order/compose"),
            meta: {
              title: "合成藏品",
              name: "藏品合成",
              isMenu: false,
              isNavBar: false,
              keep: true
            },
          },
          {
            path: "/listinfo",
            name: "listinfo",
            component: () => import("@/views/me/order/listinfo"),
            meta: {
              title: "合成消耗记录",
              name: "合成消耗记录",
              isMenu: false,
              isNavBar: true,
              keep: true
            },
          },

          {
            path: "/Recordlist",
            name: "Recordlist",
            component: () => import("@/views/me/order/Recordlist"),
            meta: {
              title: "合成记录",
              name: "合成记录",
              isMenu: false,
              isNavBar: true,
              keep: true
            },
          },
          {
            path: "/invite",
            name: "invite",
            component: () => import("@/views/me/service/invite"),
            meta: {
              title: "邀请好友",
              name: "邀请好友",
              isMenu: false,
              isNavBar: false,
              keep: true
            },
          },
          {
            path: "/customer",
            name: "customer",
            component: () => import("@/views/me/service/customer"),
            meta: {
              title: "客服",
              name: "我的客服",
              isMenu: false,
              isNavBar: true,
              keep: true
            },
          },
          {
            path: "/about",
            name: "about",
            component: () => import("@/views/me/service/about"),
            meta: {
              title: "关于我们",
              name: "关于我们",
              isMenu: false,
              isNavBar: true,
              keep: true
            },
          },
          {
            path: "/invitarecords",
            name: "invitarecords",
            component: () => import("@/views/me/service/invita-records"),
            meta: {
              title: "邀请记录",
              name: "邀请记录",
              isMenu: false,
              isNavBar: true,
              keep: true
            },
          },
          {
            path: "/Airdrop",
            name: "Airdrop",
            component: () => import("@/views/me/service/Airdrop"),
            meta: {
              title: "空投兑换",
              name: "空投兑换",
              isMenu: false,
              isNavBar: true,
              keep: true
            },
          },

          {
            path: "/pageInner",
            name: "pageInner",
            component: () => import("@/views/me/order/pageInner"),
            meta: {
              title: "藏品详情",
              name: "藏品详情",
              isMenu: false,
              isNavBar: true,
              keep: true
            },
          },
          {
            path: "/composed",
            name: "composed",
            component: () => import("@/views/me/order/composed"),
            meta: {
              title: "藏品合成",
              name: "藏品合成",
              isMenu: false,
              isNavBar: true,
              keep: true
            },
          },

          {
            path: "/Giftrecord",
            name: "Giftrecord",
            component: () => import("@/views/me/order/Gift-record"),
            meta: {
              title: "赠与记录",
              name: "转赠记录",
              isMenu: false,
              isNavBar: true,
              keep: true
            },
          },
          {
            path: "/Mygift",
            name: "Mygift",
            component: () => import("@/views/me/order/Mygift"),
            meta: {
              title: "我的礼物",
              name: "我的礼物",
              isMenu: false,
              isNavBar: true,
              keep: true,

            },
          },

          {
            path: "/order",
            name: "order",
            component: () => import("@/views/me/order/order"),
            meta: {
              title: "我的订单",
              name: "我的订单",
              isMenu: false,
              // isNavBar: true,
              keep: true

            },
          },


          {
            path: "/Orderdetails",
            name: "Orderdetails",
            component: () => import("@/views/me/order/Orderdetails"),
            meta: {
              title: "订单详情",
              name: "订单详情",
              isMenu: false,
              isNavBar: true,
              keep: false

            },
          },

        ]
      },
      {
        path: "/null",
        name: "null",
        component: () => import("@/views/null"),
        meta: {
          title: "暂未开放",
          name: "暂未开放",
          isNavBar: true
        }
      }



    ]


  },

];

const router = createRouter({
  history: createWebHashHistory(),
  routes,
});
router.beforeEach((to, from, next) => {
  // chrome
  document.body.scrollTop = 0
  // firefox
  document.documentElement.scrollTop = 0
  // safari
  window.pageYOffset = 0
  next()
})
export default router;
